package cn.edu.uestc.software.advice;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.HashMap;
import java.util.Map;

@RestControllerAdvice
public class MyExceptionHandlerAdvice {
    @ExceptionHandler(Throwable.class)
    public Map<String,Object> exceptionCheck(Throwable t){
        Map<String,Object> map = new HashMap<>();
        map.put("code","999");
        map.put("msg","异常拦截");
        map.put("message",t);
        return map;
    }
}
